package work3;

/**
 * 模拟三个老师同时分发30份笔试试卷，每个老师相当于一个线程。
 */
public class Test implements Runnable{
    private int papers = 30;
    @Override
    public void run() {
        while (papers > 0){
            System.out.println(Thread.currentThread().getName()+ "正在发第" + papers-- + "张试卷");
        }
    }

    public static void main(String[] args) {
        Test test = new Test();
        new Thread(test,"A老师").start();
        new Thread(test,"B老师").start();
        new Thread(test,"C老师").start();
    }
}
